package com.csyf.manager.schedule;

import com.csyf.manager.service.SysTradeSummaryService;
import com.csyf.manager.service.impl.SysAgentBalanceBiz;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: Enzo
 * @Date: 2018/5/7 10:18
 */

@Slf4j
public class DayProcessSchedule implements Job {


    @Autowired
    private SysTradeSummaryService sysTradeSummaryService;

    @Autowired
    private SysAgentBalanceBiz sysAgentBalanceBiz;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("\n=================================\nDayProcessSchedule\n===============================>>");


        log.info("scheduled : {}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

        log.info("0 0 2 * * ? ");
        sysTradeSummaryService.sumYesterdayData(1);

        log.info("统计每天的收益");
        sysTradeSummaryService.sumprofitByDay(1);

        log.info("------统计NmPay的交易--------------");
        sysAgentBalanceBiz.queryNMChannnelData(1);

        log.info("-------统计小机支付宝的交易--------------");
        sysAgentBalanceBiz.queryXiaojiChannelData(1);

        log.info("--------统计拼多多的交易-----------------");
        sysAgentBalanceBiz.queryPingduoduoAliChannelData(1);
        sysAgentBalanceBiz.queryPingduoduoWxChannelData(1);

        //sysAgentBalanceBiz.queryBasedfMoney(1);


    }
}
